package com.h2cloud;

import java.util.Map;
import java.util.TreeMap;

/**
 * @author: wulongkai
 * @create: 2022-11-01 17:23
 **/
public class hash {
    public static void main(String[] args) {

//        long hash = (long) "421182199312111325".hashCode();
//        hash <<= 32;
//        hash |= (long) fnvHash("421182199312111325");
//        System.out.println("hash = " + hash);

//        Integer[] s = {1801035, 1801036, 1801037, 1801040};
//        Map<Integer, Integer> map = new HashMap<>();
//        for (Integer s1 : s) {
//            System.out.println(s1);
//            map.put(s1, 1);
//        }
//        System.out.println();
//        for(Integer s1 : map.keySet()){
//            System.out.println(s1);
//        }

//        String[] s = {"1801035", "1801036", "1801037", "1801040"};
//        Map<String, Integer> map = new HashMap<>();
//        for (String s1 : s) {
//            map.put(s1, 1);
//        }
//        for(String s1 : map.keySet()){
//            System.out.println(s1);
//        }

//        String[] s = {"ut_assignee_1801035", "ut_assignee_1801036", "ut_assignee_1801037", "ut_assignee_1801040"};
//        Map<String, Integer> map = new HashMap<>();
//        for (String s1 : s) {
//            map.put(s1, 1);
//        }
//        for (String s1 : map.keySet()) {
//            System.out.println(s1);
//        }


        String[] s = {"ut_assignee_1801035", "ut_assignee_1801036", "ut_assignee_1801037", "ut_assignee_1801040"};
        Map<String, Integer> map = new TreeMap<>();
        for (String s1 : s) {
            map.put(s1, 1);
        }
        for (String s1 : map.keySet()) {
            System.out.println(s1);
        }

    }

    public static int fnvHash(String data) {
        int p = 16777619;
        int hash = -2128831035;

        for (int i = 0; i < data.length(); ++i) {
            hash = (hash ^ data.charAt(i)) * 16777619;
        }

        hash += hash << 13;
        hash ^= hash >> 7;
        hash += hash << 3;
        hash ^= hash >> 17;
        hash += hash << 5;
        return Math.abs(hash);
    }
}
